import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.VBox;
import javafx.scene.text.Font;
import javafx.scene.text.Text;

public class MainMenu {
    private GameManager gameManager;
    private static final int WIDTH = 400;
    private static final int HEIGHT = 600;

    public MainMenu(GameManager gameManager) {
        this.gameManager = gameManager;
    }

    public Scene createScene() {
        VBox root = new VBox(20);
        root.setStyle("-fx-background-color: #222222; -fx-alignment: center;");
        root.setPadding(new javafx.geometry.Insets(50));

        Text title = new Text("俄罗斯方块");
        title.setFont(Font.font("Arial", 40));
        title.setFill(javafx.scene.paint.Color.WHITE);

        Button startButton = new Button("开始游戏");
        startButton.setPrefSize(200, 50);
        startButton.setFont(Font.font("Arial", 16));
        startButton.setOnAction(e -> gameManager.startGame());

        Button settingsButton = new Button("游戏设置");
        settingsButton.setPrefSize(200, 50);
        settingsButton.setFont(Font.font("Arial", 16));
        settingsButton.setOnAction(e -> gameManager.showSettings());

        Button exitButton = new Button("退出游戏");
        exitButton.setPrefSize(200, 50);
        exitButton.setFont(Font.font("Arial", 16));
        exitButton.setOnAction(e -> System.exit(0));

        root.getChildren().addAll(title, startButton, settingsButton, exitButton);

        return new Scene(root, WIDTH, HEIGHT);
    }
}
